import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push;
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};

const routes = [
  {
    path: '/',
    component: () => import('views/Login')
  },
  {
    path: '/home',
    component: () => import('views/home/Home'),
    children: [
      {
        path: '/cloudDevCenter',
        component: () => import('views/devCenter/DevCenterIndex')
      },
      {
        path: '/systemSetting',
        component: () => import('views/sysSetting/SystemSettingIndex')
      },
      {
        path: '/userInfo',
        component: () => import('views/userInfo/UserInfoIndex')
      },
      {
        path: '/operateManage',
        component: () => import('views/operManage/OperationManage')
      },
    ]
  },
  {
    path: '/visualCharts',
    component: () => import('views/visualcharts/VisualCharts.vue')
  },
  {
    path: '/datasource',
    component: () => import('views/datasource/Datasource.vue')
  },


];

const router = new VueRouter({
  routes
});

export default router
